
def select_erfen(li,val):
    left = 0
    right = len(li)-1
    while left <= right:
        mid = (left+right)//2
        if li[mid] == val:
            return mid
        elif li[mid] < val:
            left = mid+1
        else:
            right = mid-1
    return -1

li = [1,2,3,4,5,6,7,8,9]
print(select_erfen(li,10))

